package cloudPayAdmin.admin.dbapp.repo.hicatcard.user;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import cloudPayAdmin.admin.dbapp.entity.hicatcard.user.TUser;


public interface UserRepo extends JpaRepository<TUser, Long>, JpaSpecificationExecutor<TUser> {

	List<TUser> findByOpenidAndEnable(String openid, Boolean enable);
	
	@Query("select u from TUser u where u.phone = ?1 and u.enable = true")
	List<TUser> findByPhone(String phone);
	
	@Query("select u from TUser u where u.enable = true and (u.phone like %?1% or u.nickname like %?1%)")
	List<TUser> findByNicknameAndPhoneLike(String searchText);
	
}
